#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

#include "string_utilities.h"

/*
 * 
 */
int main(int argc, char** argv)
{
	double d1 = 3.14795;
	string s1 = "3.14795";
	double d2 = 3.0;
	string s2 = "3.0";

	int i1 = 3;
	string si1 = "3";

	if (str2double(s1) != d1)
	{
		cerr << "str2double : not working as expected" << endl;
		return -1;
	}
	if (str2double(s2) != d2)
	{
		cerr << "str2double : not working as expected" << endl;
		return -1;
	}
	if (str2int(si1) != i1)
	{
		cerr << "str2int : not working as expected" << endl;
		return -1;
	}

	if (double2str(d1) != s1)
	{
		cerr << "double2str : not working as expected" << endl;
		return -1;
	}
	if (double2str(d2) != "3")
	{
		cerr << "double2str : not working as expected" << endl;
		return -1;
	}
	if (int2str(i1) != si1)
	{
		cerr << "int2str : not working as expected" << endl;
		return -1;
	}

	string nums = "0123456789";
	string abc = "abcdefghijklmnopqrstuvwxyz";

	for (unsigned i = 0; i < nums.size(); i++)
	{
		if (isDigit(nums[i]) != true)
		{
			{
				cerr << "isDigit : not working as expected" << endl;
				return -1;
			}
		}
	}

	for (unsigned i = 0; i < abc.size(); i++)
	{
		if (isDigit(abc[i]) != false)
		{
			{
				cerr << "isDigit : not working as expected" << endl;
				return -1;
			}
		}
	}
	
	if (isInteger("100")!=true)
		{ cerr << "isInteger : not working as expected" << endl; return -1;}
	
	if (isInteger("100.5")!=false)
		{ cerr << "isInteger : not working as expected" << endl; return -1;}
	
	cout << "number test passed" << endl;

	return 0;
}

